package com.hxzy.jsp.utils;

import java.security.SecureRandom;
import java.util.Random;

public class Hashs {
	/**
	 * 获取一个盐值
	 * @return
	 */
	public static String createSalt() {
		Random ranGen = new SecureRandom();
		byte[] aesKey = new byte[32];
		ranGen.nextBytes(aesKey);
		StringBuffer hexString = new StringBuffer();
		for (int i = 0; i < aesKey.length; i++) {
		    String hex = Integer.toHexString(0xff & aesKey[i]);
		    if (hex.length() == 1)
		        hexString.append('0');
		    hexString.append(hex);
		}
	    return hexString.toString();
	}

}
